#pragma once

#include "Reflection/Class.h"
#include "Reflection/FunctionID.h"
#include "Reflection/TypeInstance.h"

class CGSharpField;
class CGSharpClass;
class CGSharpFieldValuesContainer;
class CNativeClass;

class CGSharpClass : public CClass
{
public:
    CGSharpClass(
        const STypeID &InTypeID
        ,ETypeFlags InExtraFlags
        ); 

    ~CGSharpClass();

    CNativeClass * GetParentNativeClass();
protected:
    friend class CGSharpGeneralizedClass;
public:
    CGSharpFieldValuesContainer* GetStaticValues() const;
protected:
    CGSharpFieldValuesContainer* StaticFieldValues= nullptr;

	//create static field values
	static void OnPostConstruct(CGSharpClass * InClass);

    class CScriptClassInstance : public ITypeInstance
    {
    protected:
        CGSharpClass * ClassType;
    public:
        CScriptClassInstance(CGSharpClass * InClassType)
            :ClassType(InClassType)
        {
        }

        virtual uint32_t GetSize() override;
        virtual uint64_t GetInstanceHash(const void * Instance) const override;

        virtual bool IsInstanceEqual(const void * Instance0,const void * Instance1) const override;
        virtual void InitInstance(void* Memory) override;
        virtual void EraseInstance(void* Instance) override;

        virtual void CloneInstance(const void* Instance,void * TargetMemory) override;
        virtual bool IsForceConvertableTo(CType * Other) override;
        void * CreateInstance() override;
        void ResetAllocated(void * InMemory) override;


        virtual CString ToDebugString(const void * Instance) const override;
        virtual int64_t GetDebugNamedChildNum(const void * Instance) const override;
        virtual CType* GetDebugNamedChildType(int64_t Index,const void * Instance) const override;
        virtual CString GetDebugNamedChildName(int64_t Index,const void * Instance) const override;
        virtual const void* GetDebugNamedChildValue(int64_t Index,const void * Instance) const override;
    };
};

